﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.ComponentModel.DataAnnotations;

namespace TaoNiuOA.Models
{
    /// <summary>
    /// 用户权根
    /// </summary>
    public class UserRole
    {
        [Key]
        public int UserRoleID { get; set; }

        //public int UserID { get; set; }

        [Display(Name = "部门管理权限")]
        public bool Department { get; set; }

        [Display(Name = "任务审核权限")]
        public bool TaskApprove { get; set; }

        [Display(Name = "任务添加权限")]
        public bool TaskAdd { get; set; }

        [Display(Name = "职位管理权限")]
        public bool UserGroup { get; set; }

        [Display(Name = "成员管理权限")]
        public bool User { get; set; }

        [Display(Name = "批假权限")]
        public bool Apply { get; set; }

        public User GetUser()
        {
            var db = new DbEntity();
            var user = db.Users.SingleOrDefault(n => n.UserRoleID == this.UserRoleID);
            if (user == null)
                user = new User();
            return user;
        }
    }
}
